#ifndef _DS18B20_H_
#define _DS18B20_H_


#include <stdio.h>

//------ DS18B20 Config type define
typedef enum _TEMP_CONBITS {
	DS_9BIT_TYPE,
	DS_10BIT_TYPE,
	DS_11BIT_TYPE,
	DS_12BIT_TYPE	
} DS_TEMP_T;


//------ DS18B20 registers define 
typedef struct _DS_REG {
	// ROM register
	uint8_t ds_id;			// 8 bits, should be 0x19
	uint8_t serial_num[6];	// 48 bits serial number
	uint8_t rom_crc7;
	// RAM register
	uint8_t temp_lsb;
	uint8_t temp_msb;
	uint8_t usr_byte[2];
	uint8_t config;
	uint8_t reserve[3];
	uint8_t ram_crc7;

	// conver time, in ms
	unsigned int con_time;				
} DS18B20_REG_T;

int readTemp(char *buffer);

//extern int DS_open(DS18B20_REG_T * ds);
//extern int DS_start_con(DS18B20_REG_T * ds);
//extern int DS_read_temp(DS18B20_REG_T * ds);
//extern int DS_close(void);


#endif
